<template>
  <div>
    <ToolBarComponent ref="queryForm">
      <QueryBarComponent row-num="1">
        <InputComponent input-lable="序列名" input-name="sequeuceName" input-type="text"></InputComponent>
        <Button text="查询" :click-function="queryBtnClick"></Button>
      </QueryBarComponent>
    </ToolBarComponent>
    <ToolBarComponent>
      <Button text="重置" :click-function="resetSequeuce"></Button>
    </ToolBarComponent>
    <GridComponent
        ref="queryGrid"
        load-url="manage/sequeuce/querySeque.do"
        :paging-moduel="true"
        select-moduel="single"
        :auto-load="true"
        grid-name="sequeuceGrid"
        key-property-name="sequeuceName"
        max-height-prop="74%"
    >
      <GridColumnComponent index-name="sequeuceName" column-name="序列名称" width="150px"></GridColumnComponent>
      <GridColumnComponent index-name="initVal" column-name="序列起点" width="150px"></GridColumnComponent>
      <GridColumnComponent index-name="currentVal" column-name="序列当前值" width="150px"></GridColumnComponent>
      <GridColumnComponent index-name="step" column-name="序列增长步长" width="150px"></GridColumnComponent>
    </GridComponent>
  </div>
</template>

<script>
import QueryBarComponent from "@/components/toolbar/QueryBarComponent";
import InputComponent from "@/components/input/InputComponent";
import ToolBarComponent from "@/components/toolbar/ToolBarComponent";
import Button from "@/components/button/ButtonComponent";
import GridColumnComponent from "@/components/grid/GridColumnComponent";
import GridComponent from "@/components/grid/GridComponent";
import {postRequest} from "@/axio2";

export default {
  components: {QueryBarComponent, InputComponent, ToolBarComponent, Button, GridColumnComponent, GridComponent},
  name: "SequeuceQuery",
  data(){
    return{
      pagingModuel:true
    }
  },
  methods:{
    queryBtnClick:function (){
      let queryParam = this.$refs["queryForm"].getSubmitParams();
      this.$refs["queryGrid"].addQueryParams(queryParam);
      this.$refs["queryGrid"].load();
    },
    resetSequeuce:function (){
      let sequeuceName = this.$refs["queryGrid"].getSelectKeys();
      postRequest(
          "manage/sequeuce/reset.do",
          {sequeuceName:sequeuceName},
          this.queryBtnClick,
          this.queryBtnClick,
          this
      );
    }
  }
}
</script>

<style scoped>

</style>